Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust AWS keys for Archivematica SIPs #1233

Merged
merged 1 commit into from
Oct 2, 2023
Merged

Conversation

jazairi
Copy link
Contributor

@jazairi jazairi commented Sep 29, 2023

Why these changes are being introduced:

We recently merged a proposed solution to this. However, looking back at ETD-600, I realized I have the spec wrong. The current keys are missing the graduation year and month.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/ETD-593

How this addresses that need:

This updates the keys to what Joe originally requested, so that the SIP directory includes the grad month and is nested beneath the grad year. For example: etdsip/2023/June-2023_001

Side effects of this change:

None.

Developer

  • All new ENV is documented in README
  • All new ENV has been added to Heroku Pipeline, Staging and Prod
  • ANDI or Wave has been run in accordance to
    our guide and
    all issues introduced by these changes have been resolved or opened as new
    issues (link to those issues in the Pull Request details above)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer

  • The commit message is clear and follows our guidelines
    (not just this pull request message)
  • There are appropriate tests covering any new functionality
  • The documentation has been updated or is unnecessary
  • The changes have been verified
  • New dependencies are appropriate or there were no changes

Requires database migrations?

NO

Includes new or updated dependencies?

NO

@mitlib mitlib temporarily deployed to thesis-submit-pr-1233 September 29, 2023 19:02 Inactive
@jazairi
Copy link
Contributor Author

jazairi commented Sep 29, 2023

I'd like the code reviewer's input on that line length flag. In my mind, it's more readable in a single line since it's only four characters over the limit, but I could be persuaded.

@coveralls
Copy link

coveralls commented Sep 29, 2023

Coverage Status

coverage: 98.353% (+0.001%) from 98.352% when pulling 3ab83b5 on etd-593-update-aws-keys into 50d597e on main.

@JPrevost JPrevost self-assigned this Sep 29, 2023
@@ -19,7 +19,7 @@ def initialize(sip)
# This key needs to be unique. By default, ActiveStorage generates a UUID, but since we want a file path for our
# Archivematica needs, we are generating a key. We handle uniqueness on the `bag_name` side.
def keygen(sip)
"etdsip/#{sip.thesis.accession_number}/#{sip.bag_name}.zip"
"etdsip/#{sip.thesis.graduation_year}/#{sip.thesis.graduation_month}-#{sip.thesis.accession_number}/#{sip.bag_name}.zip"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because you asked...

I think:

 def keygen(sip)
    thesis = sip.thesis
    "etdsip/#{thesis.graduation_year}/#{thesis.graduation_month}-#{thesis.accession_number}/#{sip.bag_name}.zip"
end

retains readability and addresses the line length. I'm never one to force a change because a bot whined about it though, so I wouldn't say this is a required change.

Another option I feel is less readable (but you may disagree so I'll share it as well) is:

['etdsip',
  sip.thesis.graduation_year,
  "#{sip.thesis.graduation_month}-#{sip.thesis.accession_number}",
  sip.bag_name].join('/')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Thanks!

Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good on the code side. Let's make sure the preservation bucket has what we expect before merging (on slack there is an open question as to whether both were fully preserved at this time of this message).

Why these changes are being introduced:

We recently merged a proposed solution to this. However, looking
back at ETD-600, I realized I have the spec wrong. The current keys
are missing the graduation year and month.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/ETD-593

How this addresses that need:

This updates the keys to what Joe originally requested, so that
the SIP directory includes the grad month and is nested beneath
the grad year. For example: `etdsip/2023/June-2023_001`

Side effects of this change:

None.
@jazairi jazairi merged commit 031f501 into main Oct 2, 2023
1 check passed
@jazairi jazairi deleted the etd-593-update-aws-keys branch October 2, 2023 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants